package com.nbufe.observer.demo1;

/**
 * @Author Zan
 * @Create 2024/5/27 8:26
 * @ClassName: Player
 * @Description : TODO 请用一句话描述该类的功能
 */
public class Player implements Observer {

    private String name;

    public Player(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void help() {
        System.out.println(name + "收到求救通知，进行救援");
    }

    @Override
    public void beAttacked(TeamFormationAlliance tfa) {
        // 向战队联盟发送求救通知 - 由联盟进行推送
        System.out.println(name + "被攻击，请求支援");
        tfa.notify(name);
    }
}
